function Board(boardElem) {
  for (var i = 0; i < 8; ++i) {
    var rankElem = boardElem.insertRow(-1);
    for (var j = 0; j < 8; ++j) {
      var cellElem = rankElem.insertCell(-1);
      cellElem.classList.add('cell');
      if ((i + j) % 2) {
        cellElem.classList.add('white');
      } else {
        cellElem.classList.add('black');
      }
    }
  }
}

function stateUpdated() {
}

function init() {
  var leftBoardElem = goog.dom.createDom('table', {'class': 'board'}, '');
  var rightBoardElem = goog.dom.createDom('table', {'class': 'board'}, '');
  goog.dom.appendChild(document.body, leftBoardElem);
  goog.dom.appendChild(document.body, rightBoardElem);
  var leftBoard = new Board(leftBoardElem);
  var rightBoard = new Board(rightBoardElem);
  if (wave && wave.isInWaveContainer()) {
    wave.setStateCallback(stateUpdated);
  }
}
gadgets.util.registerOnLoadHandler(init);

goog.require('goog.dom');
